package com.lhkj.ct.meta.modules.gauge.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * <p>
 *
 * </p>
 *
 * @author jobob
 * @since 2023-10-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TblQutLogic对象", description="")
@Deprecated
public class TblQutLogic implements Serializable {

    private static final long serialVersionUID = 1L;
    @TableId
    @ApiModelProperty(value = "逻辑id")
    private String locId;

    @NotBlank(message = "逻辑的题目id不能为空")
    @ApiModelProperty(value = "题目id")
    private String locQutId;

    @NotBlank(message = "逻辑的选项id不能为空")
    @ApiModelProperty(value = "选项id")
    private String locOptId;

    @NotNull(message = "逻辑的选项id不能为空")
    @ApiModelProperty(value = "逻辑类型不能为NULL", example = "1", notes = "1.跳转")
    private Integer locType;

    @TableField(exist = false)
    @ApiModelProperty(value = "选项逻辑")
    @NotEmpty(message = "逻辑所关联的题目不能为空")
    @Valid
    private List<TblLogicAsso> logicAssos;

    /**
     * 比较逻辑是否相同，不包括逻辑所关联的题目
     * @param target     待比较对象
     * @return
     */
    public boolean compare(Object target) {
        if (this == target) return true;
        if (target == null || getClass() != target.getClass()) return false;
        TblQutLogic that = (TblQutLogic) target;
        return Objects.equals(locId, that.locId) &&
                Objects.equals(locQutId, that.locQutId) &&
                Objects.equals(locOptId, that.locOptId) &&
                Objects.equals(locType, that.locType);
    }

}
